3.288 \(\int (a+b \sin ^2(e+f x)) \, dx\)

Optimal. Leaf size=30 \[ a x-\frac{b \sin (e+f x) \cos (e+f x)}{2 f}+\frac{b x}{2} \]

[Out]

a*x + (b*x)/2 - (b*Cos[e + f*x]*Sin[e + f*x])/(2*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0153733, antiderivative size = 30, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 12, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167, Rules used = {2635, 8} \[ a x-\frac{b \sin (e+f x) \cos (e+f x)}{2 f}+\frac{b x}{2} \]

Antiderivative was successfully verified.

[In]

Int[a + b*Sin[e + f*x]^2,x]

[Out]

a*x + (b*x)/2 - (b*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \left (a+b \sin ^2(e+f x)\right ) \, dx &=a x+b \int \sin ^2(e+f x) \, dx\\ &=a x-\frac{b \cos (e+f x) \sin (e+f x)}{2 f}+\frac{1}{2} b \int 1 \, dx\\ &=a x+\frac{b x}{2}-\frac{b \cos (e+f x) \sin (e+f x)}{2 f}\\ \end{align*}

Mathematica [A]  time = 0.0289019, size = 33, normalized size = 1.1 \[ a x+\frac{b (e+f x)}{2 f}-\frac{b \sin (2 (e+f x))}{4 f} \]

Antiderivative was successfully verified.

[In]

Integrate[a + b*Sin[e + f*x]^2,x]

[Out]

a*x + (b*(e + f*x))/(2*f) - (b*Sin[2*(e + f*x)])/(4*f)

________________________________________________________________________________________

Maple [A]  time = 0.02, size = 32, normalized size = 1.1 \begin{align*} ax+{\frac{b}{f} \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(a+b*sin(f*x+e)^2,x)

[Out]

a*x+b/f*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)

________________________________________________________________________________________

Maxima [A]  time = 0.980732, size = 39, normalized size = 1.3 \begin{align*} a x + \frac{{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*sin(f*x+e)^2,x, algorithm="maxima")

[Out]

a*x + 1/4*(2*f*x + 2*e - sin(2*f*x + 2*e))*b/f

________________________________________________________________________________________

Fricas [A]  time = 1.84782, size = 72, normalized size = 2.4 \begin{align*} \frac{{\left (2 \, a + b\right )} f x - b \cos \left (f x + e\right ) \sin \left (f x + e\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*sin(f*x+e)^2,x, algorithm="fricas")

[Out]

1/2*((2*a + b)*f*x - b*cos(f*x + e)*sin(f*x + e))/f

________________________________________________________________________________________

Sympy [A]  time = 0.362814, size = 51, normalized size = 1.7 \begin{align*} a x + b \left (\begin{cases} \frac{x \sin ^{2}{\left (e + f x \right )}}{2} + \frac{x \cos ^{2}{\left (e + f x \right )}}{2} - \frac{\sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} & \text{for}\: f \neq 0 \\x \sin ^{2}{\left (e \right )} & \text{otherwise} \end{cases}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*sin(f*x+e)**2,x)

[Out]

a*x + b*Piecewise((x*sin(e + f*x)**2/2 + x*cos(e + f*x)**2/2 - sin(e + f*x)*cos(e + f*x)/(2*f), Ne(f, 0)), (x*
sin(e)**2, True))

________________________________________________________________________________________

Giac [A]  time = 1.08347, size = 35, normalized size = 1.17 \begin{align*} \frac{1}{4} \, b{\left (2 \, x - \frac{\sin \left (2 \, f x + 2 \, e\right )}{f}\right )} + a x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a+b*sin(f*x+e)^2,x, algorithm="giac")

[Out]

1/4*b*(2*x - sin(2*f*x + 2*e)/f) + a*x